ans = 0
for i in range(1, 100000001):
    n = len(str(i))
    if n % 2 == 0:
        front = list(map(int, str(i)))[0:n//2]
        back = list(map(int, str(i)))[n//2:n]
        if sum(front) == sum(back):
            ans += 1

print(ans)